package robots.correction;

import robots.RealGhost;

public class RealRobotCorrector extends RobotCorrector {
	private RealGhost ghost;
	public RealRobotCorrector(RealGhost ghost){
		this.ghost=ghost;
	}
	@Override
	protected void travel(int distance) {
		ghost.travel(distance,true, false);
	}

	@Override
	protected void rotate(int degrees) {
		ghost.rotate(degrees, true);
		
	}
	@Override
	public void correctAngle(int begin, int end, int sign){
		if(sign==-1){
			return;
		}
 		if (end > 25||begin>25)
			return;
		if (Math.abs(begin - end) > robotAngleCorrection) {
			int angle = Math.round(getAngle(begin, end));
			this.rotate(sign*angle);
		}
 	}
	@Override
	public void lineCorrect() {
		ghost.getCommunicator().setLineCorrect();
	}
	
}
